/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-09-26
 * Time: 11:10
 */
public class swap_Pairs {
    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }

        ListNode node = swapPairs(head.next.next);
        ListNode ret = head.next;
        ret.next = head;
        head.next = node;
        return ret;

    }
}
